package com.bw.common.websocket

import com.bw.common.utils.LogUtils
import org.java_websocket.client.WebSocketClient
import org.java_websocket.drafts.Draft_6455
import org.java_websocket.handshake.ServerHandshake
import java.net.URI


/**
 * @author:created by hahajing
 * 时间：2024/5/9 0009
 * 企鹅号:444511958
 * 描述:
 */

open class ZWebSocketClient(serverUri: URI?) : WebSocketClient(serverUri, Draft_6455()) {
    override fun onOpen(handshakedata: ServerHandshake?) {
        LogUtils.i("123", "onOpen()")
    }

    override fun onMessage(message: String?) {
        LogUtils.i("123", "onMessage()")
    }

    override fun onClose(code: Int, reason: String?, remote: Boolean) {
        LogUtils.i("123", String.format("onClose code=%s reason=%s remote=%s", code, reason, remote))
    }

    override fun onError(ex: Exception) {
        LogUtils.i("123", "onError()" + ex.message)
    }
}